Subversion Repositories OpenCV2-Cookbook

Compare Revisions

Last modification

Ignore whitespace Rev 4 → Rev 5

/trunk/Chapter 04/objectfinder.cpp
18,8 → 18,8
#include <iostream>
using namespace std;
 
#include "cv.h"
#include "highgui.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
 
#include "histogram.h"
#include "objectFinder.h"
47,7 → 47,7
cv::imshow("Reference Hist",h.getHistogramImage(imageROI));
 
// Create the objectfinder
ContentFinder finder;
ObjectFinder finder;
finder.setHistogram(hist);
 
finder.setThreshold(-1.0f);
/trunk/Chapter 04/imageComparator.h
18,8 → 18,8
#if !defined ICOMPARATOR
#define ICOMPARATOR
 
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "colorhistogram.h"
 
class ImageComparator {
/trunk/Chapter 04/histograms.cpp
18,8 → 18,8
#include <iostream>
using namespace std;
 
#include "cv.h"
#include "highgui.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "histogram.h"
 
int main()
79,11 → 79,11
cv::imshow("Stretched Histogram",h.getHistogramImage(str));
 
// Create an image inversion table
uchar lookup[256];
cv::Mat lookup;
for (int i=0; i<256; i++) {
lookup[i]= 255-i;
lookup.data[i]= 255-i;
}
 
// Apply lookup and display negative image
/trunk/Chapter 04/colorhistogram.h
1,8 → 1,8
#if !defined COLHISTOGRAM
#define COLHISTOGRAM
 
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
 
class ColorHistogram {
 
/trunk/Chapter 04/histogram.h
1,8 → 1,8
#if !defined HISTOGRAM
#define HISTOGRAM
 
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
 
class Histogram1D {
 
/trunk/Chapter 04/objectFinder.h
1,8 → 1,8
#if !defined OFINDER
#define OFINDER
 
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
 
class ObjectFinder {
 
/trunk/Chapter 04/retrieve.cpp
18,8 → 18,8
#include <iostream>
using namespace std;
 
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
 
#include "imageComparator.h"
 
71,4 → 71,4
 
cv::waitKey();
return 0;
}
}
/trunk/Chapter 04/finder.cpp
19,10 → 19,10
#include <vector>
using namespace std;
 
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\video\tracking.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/tracking.hpp>
 
#include "objectFinder.h"
#include "colorhistogram.h"
45,7 → 45,7
// Get the Hue histogram
int minSat=65;
ColorHistogram hc;
cv::MatND colorhist= hc.getHueHistogram(imageROI,minSat);
cv::MatND colorhist= hc.getHueHistogram(imageROI);
 
ObjectFinder finder;
finder.setHistogram(colorhist);
125,4 → 125,4
 
cv::waitKey();
return 0;
}
}